<table id="agency_select_datagrid" ></table>
<script type="text/javascript">

$(function(){
	
	$('#agency_select_datagrid').datagrid({
		iconCls:'icon-save',
		width:'auto',
		height:'auto',
		nowrap: false,
		fit:true,
		fitColumns:true,
		striped: true,
		url:'${request.contextPath}/backstage/agency/agency-datagrid.json',
		sortName: 'gmtCreate',
		sortOrder: 'desc',
		remoteSort: true,
		singleSelect : true,
		idField:'id',
		onBeforeLoad:function(){$('#agency_select_datagrid').datagrid('unselectAll');},
		columns:[[
					{field:'name',title:'${action.getDatagridTitle('name')}',width:80,align:'center',sortable:true},
					{field:'linkMan',title:'${action.getDatagridTitle('linkMan')}',width:80,align:'center'},
					{field:'mobile',title:'${action.getDatagridTitle('mobile')}',width:80,align:'center'},
					{field:'atAgency',title:'${action.getDatagridTitle('atAgency')}',width:80,align:'center',formatter:function(val, rec){
						if(rec.atAgency){
							return rec.atAgency.name;
						}
						return '无(总代)';
					}},
					{field:'gmtCreate',title:'${action.getDatagridTitle('gmtCreate')}',width:80,align:'center',sortable:true},
					{field:'state',title:'${action.getDatagridTitle('state')}',width:50,align:'center',formatter:function(val, rec){
						<#list states as state >
							if(val== ${state.enumValue}){
								return '${state.enumTitle}'
							}
						</#list>
					}}
				]],
		pagination:true,
		rownumbers:true
	});

});

</script>	